//
//  CancelView.m
//  DMGME
//
//  Created by ihope99 on 15/9/2.
//  Copyright (c) 2015年 GYP. All rights reserved.
//

#import "CancelView.h"

@implementation CancelView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        UILabel *choiceLable = [[UILabel alloc] init];
        choiceLable.frame = CGRectMake(10, 15, 200, 13);
        choiceLable.text = @"确定删除该用户";
        choiceLable.textAlignment = NSTextAlignmentLeft;
        choiceLable.font = [UIFont systemFontOfSize:14];
        [self addSubview:choiceLable];
        NSArray *titleName = @[@"删除",@"取消"];
        
        for (int i = 0; i <= 1; i++) {
           _btn = [UIButton buttonWithType:UIButtonTypeCustom];
            _btn.tag = i+10;
            [_btn setTitle:titleName[i] forState:UIControlStateNormal];
            [_btn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
            CGFloat bwnH = 45;
            CGFloat bwnw = 100;
            _btn.layer.borderColor = [[UIColor grayColor]CGColor];
            _btn.layer.borderWidth = 0.5;
            _btn.frame = CGRectMake(20 + ((bwnw + 20)*i), 40, bwnw, bwnH);
            _btn.titleLabel.font = [UIFont systemFontOfSize:13];
            [_btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
            [self addSubview:_btn];
//            NSLog(@"%ld",(long)_btn.tag);
        }
     
    }
    return self;
}
- (void)btnClick:(UIButton *)sender
{
//    [_delegete prensetCancelViewBtnClick:sender.tag];
    if (sender.tag == 10) {
        if (_mDelegate && _OnBtnClick) {
            SafePerformSelector([_mDelegate performSelector:_OnBtnClick withObject:self]);
        }
    }else{
        if (_mDelegate && _OnBtnClickTwo) {
            SafePerformSelector([_mDelegate performSelector:_OnBtnClickTwo withObject:self]);
        }
    }
    
}
@end


